package com.zhang.service.impl;

import com.zhang.mapper.IPowerMapper;
import com.zhang.pojo.PowerBean;
import com.zhang.service.IPowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class PowerServiceImpl implements IPowerService {

    @Autowired
    private IPowerMapper powerMapper;

    @Override
    public List<PowerBean> findAll() {
        return powerMapper.selectList(null);
    }

    @Override
    public String[] findByid(int[] roleId) {
        Set<String> str = new HashSet<>();
        for (int i = 0; i < roleId.length; i++) {
            List<PowerBean> p = powerMapper.findById(roleId[i]);
            for (int j = 0; j < p.size(); j++) {
                str.add(p.get(i).getName());
            }
        }
        String[] s = {};
        // 获取set集合数据
        for (Iterator iterator = str.iterator(); iterator.hasNext();) {
            String string = (String) iterator.next();
            System.out.println(string);
        }
        return null;
    }

}
